/*
*  Copyright 2020-2021 Li Fei
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.pengshun.modules.api.coal.domain;

import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.List;

/**
* @description /
* @author lifei
* @date 2020-11-06
**/
@Entity
@Data
@Table(name="ps_coal")
public class Coal implements Serializable {

    @Column(name = "name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "名称")
    private String name;

    @Column(name = "merchant_id")
    @ApiModelProperty(value = "商户ID")
    private Long merchantId;

    @Column(name = "merchant_name")
    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    @Column(name = "category_name")
    @ApiModelProperty(value = "煤炭类型")
    private String categoryName;

    @Column(name = "category_code")
    @ApiModelProperty(value = "煤炭类型编码")
    private String categoryCode;

    @Column(name = "mine_mouth_name")
    private String mineMouthName;


    @Column(name = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "status")
    @ApiModelProperty(value = "状态 状态(状态0:删除 1:正常2 未发布,3:关闭)")
    private Integer status;

    @Column(name = "create_by")
    @ApiModelProperty(value = "创建人")
    private String createBy;

    @Column(name = "create_time")
    @UpdateTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "update_by")
    @ApiModelProperty(value = "更新人")
    private String updateBy;

    @Column(name = "update_time")
    @UpdateTimestamp
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @Column(name = "price")
    @ApiModelProperty(value = "价格")
    private BigDecimal price;

    @Column(name = "is_show")
    @ApiModelProperty(value = "状态（0：未上架，1：上架）")
    private Integer isShow;

    @Column(name = "sell_time")
    @ApiModelProperty(value = "上架时间")
    private Timestamp sellTime;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "coal_id")
    @ApiModelProperty(value = "id")
    private Long coalId;

    private Long coalCategoryId;

    @Column(name = "mine_mouth_id")
    @ApiModelProperty(value = "所属煤矿ID")
    private Long mineMouthId;

    @Column(name = "coal_price")
    @ApiModelProperty(value = "煤矿价格")
    private BigDecimal coalPrice;

    @Column(name = "price_unit")
    @ApiModelProperty(value = "价格单位")
    private  String priceUnit;

    @Column(name = "calorific_value")
    @ApiModelProperty(value = "发热量")
    private String calorificValue;

    @Column(name = "coal_technology_name")
    @ApiModelProperty(value = "煤炭工艺")
    private String coalTechnologyName;

    @Column(name = "coal_technology_code")
    @ApiModelProperty(value = "煤炭工艺编码")
    private String coalTechnologyCode;

    @Column(name = "laboratory_time")
    @ApiModelProperty(value = "化验时间")
    private Timestamp laboratoryTime;

    @Column(name = "laboratory_bill_pic")
    @ApiModelProperty(value = "化验单图片")
    private String laboratoryBillPic;

    @Column(name = "laboratory_company")
    @ApiModelProperty(value = "化验单单位")
    private String laboratoryCompany;

    @Column(name = "coal_pic")
    @ApiModelProperty(value = "煤炭图片")
    private String coalPic;

    @ApiModelProperty(value = "用途")
    private String useing;

    @OneToMany(cascade={CascadeType.PERSIST,CascadeType.REMOVE})
    @JoinColumn(name = "coal_id")
    private List<CoalInfo> coalInfos;

}